/*
Crossing the Line: Evidence for the categorization theory of spatial voting

REPLICATION FILE FOR Britain ANALYSIS

APRIL 19, 2023
*/

cd ["enter path to files here"]
clear
use "RP Britain data.dta"

**PART 1
*Norm effect (Figure 2)
mean Q3b if Q1~=997 & Q3b~=997 & (Q1>52 | Q1<48) & treatment == 1 & Q2_timing >10 & Q1_timing >5
mean Q3b if Q1~=997 & Q3b~=997 & (Q1>52 | Q1<48) & treatment == 0 & Q2_timing >10 & Q1_timing >5
ttest Q3b if Q1~=997 & Q3b~=997 & (Q1>52 | Q1<48)  & Q2_timing >10 & Q1_timing >5 , by(treatment) 

*Vote effect (Figure 3)
mean Q2b if Q1~=997 & Q2b~=997 & (Q1>52 | Q1<48) & treatment == 1 & Q2_timing >10 & Q1_timing >5
mean Q2b if Q1~=997 & Q2b~=997 & (Q1>52 | Q1<48) & treatment == 0 & Q2_timing >10 & Q1_timing >5
ttest Q2b if Q1~=997 & Q2b~=997 & (Q1>52 | Q1<48)  & Q2_timing >10 & Q1_timing >5 , by(treatment) 


**PART 2
*Conflict by Norm Prime and Strength
stset Q4_timing 
streg c.conflict3##i.treatment C_count if (Q1<=48 | Q1>=52) & Q1!=997 & Q2_timing >10 & Q1_timing >5, dist(weib) time
margins, dydx(conflict3) over(treatment)


streg c.conflict3##c.norm1_diff_ind2##i.treatment C_count if (Q1<=48 | Q1>=52) & Q1!=997 & Q2_timing >10 & Q1_timing >5, dist(weib) time 
margins, at(c.norm1_diff_ind=(-0.4(0.1)2) treatment=(0,1)) dydx(conflict3)
marginsplot, ytitle("Effect of Additional Incongruence (Seconds)") xtitle("Vote Norm Strength") title("")  plotopts(yline(0) legend(symysize(10) order(2 "Norm Primed" 1 "Not Primed") position(0) bplacement(nwest))) // (Figure 4)
contrast c.conflict3#c.norm1_diff_ind2#i.treatment







